<template>
	<view class="cardstyle">
		<slot name="header"></slot>
		<view class="titlebox">{{title}}</view>
		<view class="tipsbox">
			<text class="top-tag" v-if="isTop">置顶</text>
			<text class="source">{{author}}</text>
			<text class="comment">{{comments}}评</text>
			<view class="time-wrap">
				<text class="time">{{time}}</text>
			</view>
		</view>
		<slot name="tips"></slot>
		<slot name="footer"></slot>
	</view>
</template>

<script>
	export default {
		name: "cartViewText",
		data() {
			return {
			}
		},
		
		props: {
			title: {
				type: String,
				default: "新闻标题",
				require: true
			},
			isTop: {
				type: Boolean,
				default: false,
				require: true
			},
			author: {
				type: String,
				default: "来源",
				require: true
			},
			comments: {
				type: Number,
				default: 0,
				require: true
			},
			time: {
				type: String,
				default: "2025.1.1",
			}
		},
		methods: {

		}
	}
</script>

<style>
	.cardstyle {
		padding: 10rpx;
		margin: 10rpx;
		background-color: aliceblue;
		border-radius: 8rpx;
		box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.1);

	}

	.titlebox {
		font-size: 32rpx;
		font-weight: bold;
		line-height: 48rpx;
		margin-bottom: 8rpx;
	}

	.tipsbox {
		display: flex;
		align-items: center;
		font-size: 24rpx;
		color: #666;
		justify-content: space-between;
	}

	.top-tag {
		color: #f00;
		margin-right: 12rpx;
	}

	.source {
		margin-right: 12rpx;
	}

	.comment {
		margin-right: 12rpx;
	}

	.time-wrap {
		flex: 1;
		display: flex;
		justify-content: flex-end;
	}
</style>